<%@page import="Bean.memberBean"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@include file="../common.jsp" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<html>
<head>
<style type="text/css">
.tblcss {
	float: left;
	width: 600px;
	font-size: small;
	font-family: 맑은 고딕;
	margin: 20px 20px 40px 0px;
}
</style>
<link href="./css/Design.css" rel="stylesheet" type="text/css">
<link href="./css/table.css" rel="stylesheet" type="text/css">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
	<title>회원 수정페이지</title> 
	<script type="text/javascript" src="./jquery/jquery.js"></script>
	<script type="text/javascript" src="./jquery/jquery.numeric.js"></script>
	<script type="text/javascript" src="./js/member.js"></script>
	<script type="text/javascript">
		$(document).ready(function() {
			$("#mpassword").focus(); /* 시작하자 마자 포커스 주기 */	
			
			//alert('호호') ;
			$("#mssn1").numeric({ 
				decimal: false, 
				negative: false 
			}, 
			function() { 
				alert("Positive integers only");
				this.value = ""; 
				this.focus(); 
			});
			$("#mssn1").blur(function(){ /* 포커스를 벗어 날 때 발생 */				
				var currval = $(this).val();
				if(isNaN( currval ) || currval.length < 6 ){
					alert('6자리의 숫자를 입력해 주세요');
				}
			});
</script>
<script language="javascript">
		function Check(){
			/* var form = document.myform;
			if(!form.mpassword.value){
				alert("비번입력해");
				form.mpassword.focus();
				return; 
			} */
			
			var mpassword = $.trim($("#mpassword").val());
			if(mpassword == ""){
				alert("비밀 번호를 입력하세요");
				$("#mpassword").val("");
				$("#mpassword").focus();
				return false ;
			}
			var repassword = $.trim($("#repassword").val());
			if(repassword == ""){
				alert("비밀 번호 재확인란이 누락되었읍니다.");
				$("#repassword").val("");
				$("#repassword").focus();
				return false ;
			}
			if( mpassword != repassword ){
				alert("비밀 번호가 일치하지 않습니다.");	
				$("#repassword").focus();
				return false ;
			}
			var mname = $.trim($("#mname").val());				
			if(mname == ""){
				alert("이름이 누락되었습니다.");		
				$("#mname").focus();
				return false ;
			}
			var mssn1 = $.trim($("#mssn1").val());				
			if(mssn1 == ""){
				alert("주민 번호 앞 자리를 입력하세요");
				$("#mssn1").val("");
				$("#mssn1").focus();
				return false ;
			}
			var mssn2 = $.trim($("#mssn2").val());				
			if(mssn2 == ""){
				alert("주민 번호 뒷 자리를 입력하세요");
				$("#mssn2").val("");
				$("#mssn2").focus();
				return false ;
			}
			var hphone2 = $.trim($("#mphone2").val());				
			if(hphone2 == ""){
				alert("핸드폰 번호를 입력하세요");
				$("#mphone2").val("");
				$("#mphone2").focus();
				return false ;
			}
			 var hphone3 = $.trim($("#mphone3").val());				
			if(hphone3 == ""){
				alert("핸드폰 번호를 입력하세요");
				$("#mphone3").val("");
				$("#mphone3").focus();
				return false ;
			}
		alert("정보가 수정되었습니다.");
		document.myform.submit();
	}
</script>	
<script type="text/javascript">
		function ZipCheck(){
			var url = "ZipCheck.members";
			window.open(url,"title","width=400, height=300");
		}
		function chan(vala){
			var value =  vala.options.selectedIndex;
			var txt = vala.options[value].text;
			document.myform.mailchoice.value = txt;
		}
	</script>
</head>		
<body>
<table align="center">
<tr>
<td colspan="5">
	<br>
<form name="myform" method="post" action="<%=myContext%>/update.member">
	<input type="hidden" name="mnum" value="${member.mnum}" />
	<input type="hidden" name="mid" value="${member.mid}" />
	<div id ="widthfordiv">
	<table  class="tblcss" align="center" border="1" >
		<thead>
		<tr>
			<td colspan="2" align="center">
				<b>기본 정보 </b>
			</td>
		</tr>
		</thead>
		<tbody>
		<tr>
			<th> * 회원 아이디 </th>
			<td>
				<input type="text" name="fakeid" disabled="disabled" value="${member.mid}">
	    	</td>
		</tr>
		<tr>
			<th> * 비밀 번호</th>
			<td><input type="password" name="mpassword" id="mpassword" value=""> 영문 소문자/숫자 조합 3~8자<br>
		</tr>
		<tr>
			<th> * 비밀 번호 확인</th>
			<td><input type="password" name="repassword" id="repassword"  value=""> 비밀 번호 확인<br>
		</tr>
		</tbody>
		<thead>
		<tr>
			<td colspan="2" align="center">
				<b>개인 신상 정보 </b>
			</td>
		</tr>
		</thead>
		<tbody>
		<tr>
			<th>한글 이름</th>
			<td><input type="text" name="mname" id="mname" value="${member.mname}"></td>
		</tr>
		<tr>
			<th>주민 등록 번호</th>
			<td>			
				<input type="text" name="mssn1" id="mssn1"  maxlength="6" size="6" value="${member.mssn1}">
				- 
				<input type="text" name="mssn2" id="mssn2"  maxlength="7" size="7" value="${member.mssn2}">			
			</td>				
		</tr>
		<tr>
			<th>휴대 전화 번호</th>
			<td>
				<select name="mphone1">
					<option value="010">010</option>
					<option value="011">011</option>
				</select>
				- 
				<input type="text" name="mphone2" id="mphone2" size="4" maxlength="4" value="${member.mphone2}"> - 
				<input type="text" name="mphone3" id="mphone3" size="4" maxlength="4" value="${member.mphone3}"> 
			</td>
		</tr>
			<tr>
						<th>E-mail</th>
						<td> <input type="text" name="email" size="12" value="${member.email}"> @
						<input type="text" name="mailchoice" size="10" value="${member.mailchoice}">
						<select id="choice" name="choice" onchange="chan(this);">
								<option value="" selected="selected">직접 입력</option>
								<option value="naver.com">naver.com</option>
								<option value="hanmail.net">hanmail.net</option>
								<option value="daum.net">daum.net</option>
								<option value="gmail.com">gmail.com</option>
						</select></td>
					</tr>
					<tr>
		<tr>
			<th>우편 번호</th>
			<td>
				<input type="text" name="mzipcode" size="7" value="${member.mzipcode}">
				<input class ="popuplog" type="button" value="우편 번호 검색" onClick="ZipCheck()">
			 </td>
		</tr>
		<tr>
			<th> 주소 </th>
			<td>
			     <input type="text" name="maddress" size="60" value="${member.maddress}">
			</td>
		</tr>
		<tr>
			<td colspan="2"><center>
				<input type="button" id="send" name="send" value="수정" onclick="javascript:Check()">&nbsp;&nbsp;
<!-- 				class ="popuplog"  -->
				<a href="<%=myContext%>/deleteuser.member"><input class ="popuplog" type="button" id="delete" name="delete" value="탈퇴"></a>&nbsp;&nbsp;
				<a href="<%=myContext%>/startHome.main"><input class ="popuplog" type="button" value="취소"></a>
				</center>
			</td>
		</tr>
		</tbody>
	</table>
	</div>
	</form>
</td>
</tr>
</table>
</body>
</html>